<!--
- File:    已删除的共享花园列表.
-->
<template>
  <div class="Web_Box">
    <div class="graden_cont" v-for="item in gardenDeletedList.data">
      <ul class="f-cb">
        <li class="mood_graden"><a><img :src="(!item.cover_img || item.cover_img == '') ? defaultGardenImg :($config.imgsite + $config.uploadImgSrc + item.cover_img + '_w150') ">
        </a></li>
        <li><a>
          <div class="graden_bg">
            <h3>{{item.garden_name}}（{{item.flower_num}}）</h3>
            <p>{{item.city_name}}</p>
            <p>创建时间：{{item.add_time}}</p>
            <div class="Release3 f-cb"><a class="rbtn"><span @click="restore(item.sg_id)"><i class="iconfont icon-huifu"></i>还原</span></a></div>
          </div>
        </a></li>
      </ul>
    </div>
    <empty-data :show="gardenDeletedList.requested && gardenDeletedList.data.length <= 0"></empty-data>
    <footer-tab></footer-tab>
  </div>
</template>

<script>
  export default{
    data() {
      return {
        defaultGardenImg: require('../../assets/images/demo/xinqing.png'),
        gardenDeletedList: {requested: false, data: []}
      }
    },
    created() {
      this.getGardenDeletedList()
    },
    methods: {
      gotoGardenDetail(id) {
        this.$router.push({name: 'garden-detail', params: {id: id}})
      },
      getGardenDeletedList() {
        this.$request.getShareGardenDeletedList().then(data => {
          this.gardenDeletedList.data = data
        }).finally(() => {
          this.gardenDeletedList.requested = true
        })
      },
      restore(id) {
        this.$request.restoreDeletedShareGarden(id).then(data => {
          this.$toast('恢复成功')
          this.gardenDeletedList = {requested: false, data: []}
          this.getGardenDeletedList()
        })
      }
    }
  }
</script>

<style>

</style>